<!--
 * @Author: daidai
 * @Date: 2022-03-01 14:13:04
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-09-27 15:04:49
 * @FilePath: \web-pc\src\pages\big-screen\view\indexs\right-top.vue
-->
<template>
	<el-carousel indicator-position="outside" v-if="pageflag" height="240px">
		<el-carousel-item v-for="item in images" :key="item">
			<el-image :src="item" fit="scale-down"></el-image>
		</el-carousel-item>
	</el-carousel>
	<Reacquire v-else @onclick="getData" style="line-height: 200px">
		重新获取
	</Reacquire>
</template>

<script>
	import {
		currentGET
	} from "api/modules";
	import station from './station.js';
	export default {
		data() {
			return {
				pageflag: false,
				stationId: 5605,
				images:[]
			};
		},
		created() {
			this.getData();
			station.$on('stationId', val => {
				this.stationId = val;
				this.getData();
			})
		},
		mounted() {
			station.$on('stationId', val => {
				this.stationId = val;
			})
		},
		beforeDestroy() {
			station.$off('stationId');
		},
		methods: {
			getData() {
				currentGET("images", {
					stationId: this.stationId
				}).then((res) => {
					if (res.flag) {
						this.pageflag = true;
						this.images = res.data;
					} else {
						this.pageflag = false;
						this.$Message({
							text: res.msg,
							type: "warning",
						});
					}
				});
			},
		},
	};
</script>
<style lang='scss' scoped>
	.right_top_inner {
		margin-top: -8px;
	}
</style>